package com.moco.launcher.bean;

import java.util.ArrayList;

import com.alibaba.fastjson.annotation.JSONField;
import com.moco.launcher.play.MusicItemInfo;

import android.os.Parcel;
import android.os.Parcelable;

public class MocoItemInfo implements Parcelable {

	@JSONField(name = "create_time")
	private String mCreateTime = null;
	private String mId = null;
	private String mPicture = null;
	private String mShortDesc = null;
	private int mSortId = -1;
	private String mSource = null;
	private String mSourceId = null;
	private String mSourceType = null;
	private String mTitle = null;
	private String mType = null;
	private String mUpdateTime = null;
	private String mUrl = null;
	private String mArtist = null;
	private String mLyric = null;

	public ArrayList<MocoAttribute> mAttrs = new ArrayList<MocoAttribute>();

	public MocoItemInfo() {

	}

	public MocoItemInfo(Parcel pl) {
		this.mCreateTime = pl.readString();
		this.mId = pl.readString();
		this.mPicture = pl.readString();
		this.mShortDesc = pl.readString();
		this.mSortId = pl.readInt();
		this.mSource = pl.readString();
		this.mSourceId = pl.readString();
		this.mSourceType = pl.readString();
		this.mTitle = pl.readString();
		this.mType = pl.readString();
		this.mUpdateTime = pl.readString();
		this.mUrl = pl.readString();
		this.mArtist = pl.readString();
		this.mLyric = pl.readString();
	}

	public String getLyric() {

		if (mLyric == null) {
			for (MocoAttribute attr : mAttrs) {
				if (attr.getAttrName().equals("LYRIC")) {
					mLyric = attr.getAttrValue();
					break;
				}
			}
		}
		return mLyric;
	}

	public String getArtist() {
		if (mArtist == null) {
			for (MocoAttribute attr : mAttrs) {
				if (attr.getAttrName().equals("ARTIST")) {
					mArtist = attr.getAttrValue();
					break;
				}
			}
		}
		return mArtist;
	}

	public void setType(String type) {
		this.mType = type;
	}

	public String getType() {
		return this.mType;
	}

	public void setUpdateTime(String updateTime) {
		this.mUpdateTime = updateTime;
	}

	public String getUpdateTime() {
		return this.mUpdateTime;
	}

	public void setUrl(String url) {
		this.mUrl = url;
	}

	public String getUrl() {
		return this.mUrl;
	}

	public void setCreateTime(String createTime) {
		mCreateTime = createTime;
	}

	public String getCreateTime() {
		return this.mCreateTime;
	}

	public void setSource(String source) {
		mSource = source;
	}

	public String getSource() {
		return mSource;
	}

	public void setSourceId(String sourceid) {
		this.mSourceId = sourceid;
	}

	public String getSourceId() {
		return this.mSourceId;
	}

	public void setSourceType(String type) {
		this.mSourceType = type;
	}

	public String getSourceType() {
		return this.mSourceType;
	}

	public void setTitle(String title) {
		mTitle = title;
	}

	public String getTitle() {
		return mTitle;
	}

	public void setDesc(String desc) {
		mShortDesc = desc;
	}

	public void setId(String id) {
		mId = id;
	}

	public void setPicture(String picture) {
		mPicture = picture;
	}

	public void setSortId(int sortid) {
		mSortId = sortid;
	}

	public String getDesc() {
		return mShortDesc;
	}

	public String getId() {
		return mId;
	}

	public String getPicture() {
		return mPicture;
	}

	public int getSortId() {
		return mSortId;
	}

	@Override
	public int describeContents() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public void writeToParcel(Parcel dest, int flags) {
		dest.writeString(this.mCreateTime);
		dest.writeString(this.mId);
		dest.writeString(this.mPicture);
		dest.writeString(this.mShortDesc);
		dest.writeInt(this.mSortId);
		dest.writeString(this.mSource);
		dest.writeString(this.mSourceId);
		dest.writeString(this.mSourceType);
		dest.writeString(this.mTitle);
		dest.writeString(this.mType);
		dest.writeString(this.mUpdateTime);
		dest.writeString(this.mUrl);
		dest.writeString(this.mArtist);
		dest.writeString(this.mLyric);
	}

	public static final Parcelable.Creator<MocoItemInfo> CREATOR = new Parcelable.Creator<MocoItemInfo>() {

		@Override
		public MocoItemInfo createFromParcel(Parcel source) {
			return new MocoItemInfo(source);
		}

		@Override
		public MocoItemInfo[] newArray(int size) {
			return new MocoItemInfo[size];
		}
	};
}
